package tech.aistar.design.factory.version07;

/**
 * 本类用来演示:
 *
 * @author: success
 * @date: 2021/3/22 3:32 下午
 */
public class UserDaoImpl2 implements IUserDao{
    //设计原则 - 少用继承,多用合成复用原则.

    //设计原则 - 依赖倒置原则
    private IUserDao userDao;

    public UserDaoImpl2(){
        System.out.println("UserDaoImpl2....version02...");
        this.userDao = new UserDaoImpl();//组合关系
    }

    @Override
    public void fly() {
        userDao.fly();
        System.out.println("飞2米...");
    }
}
